package com.zhiyou.serviceImpl;


import com.zhiyou.dao.LesDao;
import com.zhiyou.daoImpl.LesDaoImpl;

import com.zhiyou.model.Lessee;
import com.zhiyou.service.LesService;
import com.zhiyou.util.PageBean;

public class LesServiceImpl implements LesService {

	@Override
	public PageBean<Lessee> show(int pc ,int ps) {
		LesDao ld = new LesDaoImpl();
		PageBean<Lessee> pageBean = ld.findAll(pc, ps);
		return pageBean;
	}

	@Override
	public Lessee find(int id) {
		LesDao ld = new LesDaoImpl();
		Lessee lessee = ld.findById(id);
		return lessee;
	}

	@Override
	public boolean delete(int id) {
		LesDao ld = new LesDaoImpl();
		boolean flag = ld.delete(id);
		return flag;
	}

	@Override
	public boolean update(Object[] obj) {
		LesDao ld = new LesDaoImpl();
		boolean flag = ld.update(obj);
		return flag;
	}

	@Override
	public boolean add(Object[] obj) {
		LesDao ld = new LesDaoImpl();
		boolean flag = ld.add(obj);
		return flag;
	}

	@Override
	public boolean dels(int[] id) {
		// TODO Auto-generated method stub
		LesDao ld = new LesDaoImpl();
		int id1[] = ld.dels(id);
		for(int i = 0;i<id1.length;i++){
			if(id1[i] == 0){
				return false;
			}
		}
		return true;
	}

	@Override
	public PageBean<Lessee> find(String name, String sex, String nativeplace, int pc, int ps) {
		LesDao ld = new LesDaoImpl();
		PageBean<Lessee> pageBean = ld.find(name, sex, nativeplace, pc, ps);
		return pageBean;
	}
	
}
